<script setup lang='ts'>
//导入pinia
import { useCounterStore } from '@/stores/users'
import { computed } from 'vue'
//使用pinia
const userStore = useCounterStore()

//通过计算属性获取 token 和 userId,获取到了.表示已经登录过了
const login = computed(() => {
  const result = userStore.token && userStore.userid
  return result
})
</script>
<template>
  <van-tabbar  route active-color="#ee0a24" inactive-color="#a7a8bd">
    <van-tabbar-item replace to="/home" icon="wap-home">主页</van-tabbar-item>
    <van-tabbar-item replace to="/cart" icon="shopping-cart">购物车</van-tabbar-item>
    <van-tabbar-item replace to="/center" v-if="login" icon="like">我的</van-tabbar-item>
    <van-tabbar-item replace to="/login" v-else icon="like">登录</van-tabbar-item>
  </van-tabbar>
</template>
<style lang='scss'>

</style>
